//
//  ViewController.m
//  ScreenPoPDemo
//
//  Created by wr on 2019/7/4.
//  Copyright © 2019年 wanmengchao. All rights reserved.
//

#import "ViewController.h"
#import "SecondViewController.h"
@import YSPOPGesture;
@interface ViewController ()<POPGestureRecognizerManagerProtocol>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initScreenPoP];
    [self initSomeThing];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)initScreenPoP {
//    PopGestureRecognizerManager *manager = [PopGestureRecognizerManager shareManager];
//    manager.config.returnImageName = @"icon_pop_jt";
//    manager.config.returnHomeImageName = @"icon_pop_home";
//    [manager registerManagerWithConfig:nil completeBlock:^(BOOL isSuccess, NSString *failString) {
//        if (!isSuccess) {
//            NSLog(@"%@",failString);
//        }
//    }];
    
    POPGestureRecognizerManager *manager = POPGestureRecognizerManager.shared;
    manager.config.returnImage = [UIImage imageNamed:@"icon_pop_jt"];
    manager.config.returnHomeImage = [UIImage imageNamed:@"icon_pop_home"];
    [manager registerMangerWithConfiger:nil completeBlock:^(BOOL, NSString * _Nonnull) {
        
    }];
    
}

- (void)initSomeThing {
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"这是第一个控制器";
    UIButton *jumpButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [jumpButton setTitle:@"跳第二个控制器" forState:UIControlStateNormal];
    [jumpButton addTarget:self action:@selector(jump) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:jumpButton];
    jumpButton.frame = CGRectMake(self.view.frame.size.width / 2 - 100, self.view.frame.size.height / 2 - 100, 200, 200);
}

- (void)jump {
    SecondViewController *vc = [[SecondViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (BOOL)CM_GestureRecognizerPopLastController:(UIViewController *)lastController currentController:(UIViewController *)currentController {
    return YES;
}

- (BOOL)CM_GestureRecognizerBackHomeController:(UIViewController *)currentController {
    return YES;
}

@end
